<!DOCTYPE html>
<html>
<!--
Copyright 2010 The Closure Library Authors. All Rights Reserved.

Use of this source code is governed by the Apache License, Version 2.0.
See the COPYING file for details.
-->
<!--
-->
<head>
<title>
  Closure Unit Tests - goog.messaging
</title>
<script src="../base.js"></script>
<script>
  goog.require('goog.messaging');
  goog.require('goog.testing.MockControl');
  goog.require('goog.testing.jsunit');
  goog.require('goog.testing.messaging.MockMessageChannel');
</script>
</head>
<body>
<script>

function testPipe() {
  var mockControl = new goog.testing.MockControl();
  var ch1 = new goog.testing.messaging.MockMessageChannel(mockControl);
  var ch2 = new goog.testing.messaging.MockMessageChannel(mockControl);
  ch1.send('ping', 'HELLO');
  ch2.send('pong', {key: 'value'});
  goog.messaging.pipe(ch1, ch2);

  mockControl.$replayAll();
  ch2.receive('ping', 'HELLO');
  ch1.receive('pong', {key: 'value'});
  mockControl.$verifyAll();
}

</script>
</body>
</html>
